x86/mm: Make PV linear pagetables optional
authorGeorge Dunlap <george.dunlap@citrix.com>
Fri, 27 Oct 2017 13:26:27 +0000 (14:26 +0100)
committerGeorge Dunlap <george.dunlap@citrix.com>
Fri, 27 Oct 2017 13:36:45 +0000 (14:36 +0100)
commit3285e75dea89afb0ef5b3ee39bd15194bd7cc110
tree51e6fecf3a75544a69d859ca29b0ab8fa4ea7e64
parent5e2bfc23f7c9a60c01a02c619e1f3d7456ce0e93
x86/mm: Make PV linear pagetables optional

Allowing pagetables to point to other pagetables of the same level
(often called 'linear pagetables') has been included in Xen since its
inception; but recently it has been the source of a number of subtle
reference-counting bugs.

It is not used by Linux or MiniOS; but it is used by NetBSD and Novell
Netware.  There are significant numbers of people who are never going
to use the feature, along with significant numbers who need the
feature.

Add a Kconfig option for the feature (default to 'y').  Also add a
command-line option to control whether PV linear pagetables are
allowed (default to 'true').

NB that we leave linear_pt_count in the page struct.  It's in a union,
so its presence doesn't increase the size of the data struct.
Changing the layout of the other elements based on configuration
options is asking for trouble however; so we'll just leave it there
and ASSERT that it's zero.

Reported-by: Jann Horn <jannh@google.com>
Signed-off-by: George Dunlap <george.dunlap@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Release-acked-by: Julien Grall <julien.grall@arm.com>
docs/misc/xen-command-line.markdown
xen/arch/x86/Kconfig
xen/arch/x86/mm.c